package org.feng.clog.utils;

import org.feng.clog.vo.ResultVo;

/**
 * 统一返回结果工具
 *
 * @author feng
 */
public class ResultUtil {
    public static final Integer SUCCESS = 0;

    private ResultUtil() {
    }

    public static ResultVo<String> success() {
        return new ResultVo<>(SUCCESS, "操作成功");
    }

    public static <T> ResultVo<T> success(T data) {
        return new ResultVo<>(SUCCESS, data);
    }

    public static <T> ResultVo<T> error(Integer errorNo, T data) {
        return new ResultVo<>(errorNo, data);
    }

    public static <T> ResultVo<T> error(Integer errorNo, String message) {
        return new ResultVo<>(errorNo, message);
    }
}
